package org.kotemaru.gae.dstool.client.gui;
import java.io.*;

import org.kotemaru.browser.ActionBrowserFrame;

public class StderrLogger extends PrintStream {
	private ActionBrowserFrame frame;

	public StderrLogger(ActionBrowserFrame frame) throws IOException {
		super(System.err);
		this.frame = frame;
	}

	public void print(String s) {
		s = s.replaceAll("'","\\\\'").replaceAll("\n", "\\\\n");
		frame.execute("log('"+s+"')");
	}
	public void println(String s) {
		print(s+"\n");
	}
	
}
